{extend name="common/adminBase" /}
{block name="body"}
<link rel="stylesheet" type="text/css" href="/static/xadmin/css/formSelects-v4.css"/>

<style>
    .layui-input-inline{
        width: 450px !important;
      }
  .layui-form-label{
    width:250px;
  }
  .date{
    width:212px; display: inline-block;
  }
   #uploadimg{
    position: absolute;
    top:70px;left:580px;
  }
  .layui-upload-img {
    width: 92px;
    height: 92px;
  }
    .layui-form-item{
      margin:0px auto !important;
  }
  #demo1{
      width:132px;height:165px;
  }
</style>
<body >
<div class="layui-fluid" style="background:#fff;">
  <div class="layui-row">
    <form class="layui-form">
      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>个人信息</legend>
      </fieldset>

      <div class="layui-form-item" >
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>姓名
        </label>
        <div class="layui-input-inline" >
          <input type="text"  name="name" style="width:260px;" value="{$admin.name}" placeholder="请输入姓名" required="" lay-verify="required"
                 autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item" >
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>性别
        </label>
        <div class="layui-input-inline" style="width:260px !important;;">
          <select name="sex"  >
            <option value="">选择性别</option>
            <option value="男" {if $admin.sex=='男'}selected{/if}>男</option>
            <option value="女" {if $admin.sex=='女'}selected{/if}>女</option>
          </select>
        </div>
      </div>
      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>出生年月
        </label>
        <div class="layui-input-inline" style="width:260px !important;;">
          <input name="birthday" placeholder="出生日期" value="{$admin.birthday}" id="date" autocomplete="off"  class="layui-input"/>
        </div>

      </div>
      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>身份证号
        </label>
        <div class="layui-input-inline">
          <input name="idcard" placeholder="身份证号"  style="width:260px"  id="idcard" value="{$admin.idcard}" autocomplete="off"  class="layui-input"/>
        </div>
      </div>

      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>手机号
        </label>
        <div class="layui-input-inline">
          <input name="phone" placeholder="手机号" style="width:260px"  id="phone" value="{$admin.phone}" autocomplete="off" class="layui-input"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>邮箱
        </label>
        <div class="layui-input-inline">
          <input name="email" placeholder="邮箱" style="width:260px"  id="mail" value="{$admin.email}" autocomplete="off" class="layui-input"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>政治面貌
        </label>
        <div class="layui-input-inline">
          <input name="mianmao" placeholder="政治面貌" value="{$admin.mianmao}" autocomplete="off" class="layui-input"/>
        </div>
      </div>

      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>所在单位
        </label>
        <div class="layui-input-inline">

            <div class="layui-inline">
              <select id="qu" name="school" lay-filter="qu">
                <option value="{$area.id}">{$area.title}</option>
              </select>
             </div>
             {if $school}
            <div class="layui-inline" id="school" >
              <select id="aschool" name="aschool">
                <option value="{$school.id}">{$school.title}</option>
              </select>
            </div>
            {/if}
        </div>
      </div>

      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>入职年限
        </label>
        <div class="layui-input-inline">
          {volist name="work" id="vo"}
          <input name="w_stime[]" style="margin-bottom:15px;" placeholder="开始时间" autocomplete="off" value="<?php echo $vo['w_stime'];?>" class="layui-input date"/> 至 <input name="w_etime[]" placeholder="截止时间" autocomplete="off" value="<?php echo $vo['w_etime'];?>" class="layui-input date"/>&nbsp;&nbsp;
          {/volist}
        </div>
      </div>

      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>授课专业
        </label>
        <div class="layui-input-inline">
          <input name="zhuanye" placeholder="授课专业" value="{$admin.zhuanye}" autocomplete="off" class="layui-input"/>
        </div>
      </div>

       <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>职称
        </label>
        <div class="layui-input-inline">
          <input name="professiona" placeholder="职称" value="{$admin.job}" autocomplete="off" class="layui-input"/>
        </div>
      </div>

      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>职务
        </label>
        <div class="layui-input-inline">
          <select name="professiona">
            <option value="">职位</option>
            <option {if $admin.professiona=="校长"}selected{/if} value="校长">校长</option>
            <option {if $admin.professiona=="德育主任"}selected{/if} value="德育主任">德育主任</option>
            <option {if $admin.professiona=="班主任"}selected{/if} value="班主任">班主任</option>
            <option {if $admin.professiona=="其他"}selected{/if} value="其他">其他</option>
          </select>
        </div>
      </div>



      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>学段
        </label>
        <div class="layui-input-inline">
              <input type="checkbox" name="xueduan[]" {if in_array('小低',$xueduan)} checked=''{/if} lay-skin="primary" value="小低"  title="小低" > 
              <input type="checkbox" name="xueduan[]" {if in_array('小中',$xueduan)} checked=''{/if}  lay-skin="primary" value="小中"  title="小中" > 
              <input type="checkbox" name="xueduan[]" {if in_array('小高',$xueduan)} checked=''{/if}  lay-skin="primary" value="小高"  title="小高" > 
              <input type="checkbox" name="xueduan[]" {if in_array('初中',$xueduan)} checked=''{/if}  lay-skin="primary" value="初中"  title="初中" > 
              <input type="checkbox" name="xueduan[]" {if in_array('高中',$xueduan)} checked=''{/if}  lay-skin="primary" value="高中"  title="高中" > 
        </div>
      </div>

      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>是否为专职教师
        </label>
        <div class="layui-input-inline">
            <div class="layui-inline">
              <select name="if_teacher" lay-filter='teacher'>
                <option value="">是否为专职教师</option>
                <option value="1" {if $admin.if_teacher==1}selected=''{/if}>是</option>
                <option value="2" {if $admin.if_teacher==2}selected=''{/if}>否</option>
              </select>
            </div>
            {if $admin.other}
            <div class="layui-inline" style="display:none;" id="other">
                <input name="other" placeholder="所任职务" value="{$admin.other}" autocomplete="off"  class="layui-input"/>
            </div>
            {/if}
        </div>
        
      </div>



      <div class="layui-form-item">
        <label for="username" class="layui-form-label">
          <span class="x-red">*</span>从事心理健康教育工作年限
        </label>

        <div class="layui-input-inline" id="teach">
          <div class="layui-input-inline" >
             <input type="text" autocomplete="off"  class="layui-input" value="{$admin.pwork}" />
            </div>
        </div>

      </div>
          <div class="layui-form-item" pane="">
            <label class="layui-form-label">持证情况</label>
            <div class="layui-input-block">
              <input type="checkbox" name="zhizheng[]" {if in_array('A证',$zhizheng)} checked=''{/if} lay-skin="primary" value="A证" id="sc1" lay-filter="switchTest" title="A证" > 
              <!--<input type="checkbox" name="zhizheng[]" lay-skin="primary" value="A2证" title="A2证"><button class="layui-btn">上传</button>&nbsp;&nbsp;&nbsp;&nbsp;-->
              <input type="checkbox" name="zhizheng[]" {if in_array('B证',$zhizheng)} checked=''{/if} lay-skin="primary" value="B证" id="sc2" lay-filter="switchTest"  title="B证">
              <!--<input type="checkbox" name="zhizheng[]" lay-skin="primary" value="B2证" title="B2证"><button class="layui-btn">上传</button>&nbsp;&nbsp;&nbsp;&nbsp;-->
              <input type="checkbox" name="zhizheng[]" {if in_array('C证',$zhizheng)} checked=''{/if} lay-skin="primary" value="C证" id="sc3" lay-filter="switchTest"  title="C证">
              
              <input type="checkbox" name="zhizheng[]" {if in_array('其他',$zhizheng)} checked=''{/if} lay-skin="primary" value="其他" id="sc4" lay-filter="switchTest"  title="其他">
              
              <input type="checkbox" name="zhizheng[]" {if in_array('无',$zhizheng)} checked=''{/if} lay-skin="primary" value="无" id="sc5" lay-filter="switchTest" title="无" >
            </div>
          </div>
        
        <div class="layui-upload" id="sc" style="display:none;margin:0px 150px;">
          <button type="button" class="layui-btn layui-btn-normal" id="testList">上传证书</button> 
          <div class="layui-upload-list" style="max-width: 1000px;">
            <table class="layui-table">
              <thead>
                <tr>
                    <th>文件名</th>
                    <th>预览</th>
       
                </tr>
              </thead>
              <tbody id="demoList">
                {volist name="zsfield" id="vo" key="key"}
                    <tr id="zs_{$key}">
                        <td>{$vo}<input type="hidden" name="zsfield[]"  /></td>

                        <td><img src="{$vo}" /></td>
                    </tr>
                {/volist}
              </tbody>
            </table>
          </div>
          <button type="button" class="layui-btn" id="testListAction">开始上传</button>
        </div> 
      
      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>工作简历 </legend> 
      </fieldset>
      <div class="gongzuojingli">
        {volist name="work" id="vo" key="key"}
        <div id="w_1000{$key}">
        <div class="layui-form-item">
          <label for="username" class="layui-form-label">
            <span class="x-red">*</span>时间
          </label>
          <div class="layui-input-inline">
            <input name="w_stime[]" placeholder="开始时间" autocomplete="off" value="{$vo.w_stime}" class="layui-input date"/> 至 <input name="w_etime[]" placeholder="截止时间" autocomplete="off"  value="{$vo.w_etime}"  class="layui-input date"/>&nbsp;&nbsp; 
          </div>
        </div>
        <div class="layui-form-item">
          <label for="username" class="layui-form-label">
            <span class="x-red">*</span>所在单位
          </label>
          <div class="layui-input-inline">
            <input name="w_danwei[]" placeholder="所在单位" value="{$vo.w_danwei}" autocomplete="off" class="layui-input"/>
          </div>
        </div>
        <div class="layui-form-item">
          <label for="username" class="layui-form-label">
            <span class="x-red">*</span>经历
          </label>
          <div class="layui-input-inline">
            <textarea placeholder="请输入内容" name="w_jingli[]"  class="layui-textarea">{$vo.w_jingli}</textarea>
          </div>
        </div>

          </div>
        {/volist}
      </div>

      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>培训经历 </legend>
      </fieldset>
      <div class="peixunjingli">
        {volist name="peixun" id="vo"}
        <div id="p_1000{$key}">
        <div class="layui-form-item">
          <label for="username" class="layui-form-label">
            <span class="x-red">*</span>时间
          </label>
          <div class="layui-input-inline">
            <input name="p_stime[]" placeholder="开始时间" autocomplete="off" value="{$vo.p_stime}" class="layui-input date"/> 至 <input name="p_etime[]" placeholder="截止时间"  autocomplete="off" value="{$vo.p_etime}" class="layui-input date"/>&nbsp;  
          </div>
        </div>
        <div class="layui-form-item">
          <label for="username" class="layui-form-label">
            <span class="x-red">*</span>所在单位
          </label>
          <div class="layui-input-inline">
            <input name="p_danwei[]" placeholder="所在单位" autocomplete="off" value="{$vo.p_danwei}" class="layui-input"/>
          </div>
        </div>
        <div class="layui-form-item">
          <label for="username" class="layui-form-label">
            <span class="x-red">*</span>经历
          </label>
          <div class="layui-input-inline">
            <textarea placeholder="请输入内容" name="p_jingli[]" class="layui-textarea">{$vo.p_jingli}</textarea>
          </div>
        </div>
        </div>
        {/volist}
      </div>
      <input type="hidden" name="imgurl" id="imgurl" value="{$admin.imgurl}" />
      <div class="layui-form-item">
        <label for="L_repass" class="layui-form-label">
        </label>

      </div>
    </form>
    <div style="width:30%;margin:0px auto;">
                                {if $admin.status==2}
                                <a title="提交审核" class="layui-btn" style="margin-right:40px;"  href="#" onclick="changestatus({$admin.id})">
                                    审核
                                </a>
                                <a title="拒绝" class="layui-btn layui-btn-danger"  href="#" onclick="nochangestatus({$admin.id})">
                                    拒绝
                                </a>
                                {/if}
    </div>
    <div class="layui-upload" id="uploadimg">

      <div class="layui-upload-list">
        <img class="layui-upload-img" src="{$admin.imgurl}" id="demo1">
        <p id="demoText"></p>
      </div>
      <div style="width: 95px;">

      </div>
      <button type="button" class="layui-btn" id="test1" style="margin-top: 10px;">上传图片</button>
    </div>
  </div>
</div>
<script>
function changestatus(id){
        $.ajax({
            url:"/index/wei/changestatus",
            type:"post",
            data:{id:id},
            dataType:"json",
            success:function (res) {
                if(res.code==0){
                    lay.msg('无权限');return false;
                }
                xadmin.close();
                // 可以对父窗口进行刷新
                xadmin.father_reload();
            }
        });
    }
    function nochangestatus(id){
        // alert(123);return false;
        layer.prompt({title: '输入拒绝原因，并确认', formType: 0}, function(pass, index){
            // alert(pass);return false;
            $.ajax({
                url:"/index/wei/nochangestatus",
                type:"post",
                data:{id:id,msg:pass},
                dataType:"json",
                success:function (res) {
                    if(res.code==0){
                        layer.msg('无权限');return false;
                    }
                    layer.close(index);
                    xadmin.close();
                    // 可以对父窗口进行刷新
                    xadmin.father_reload();
                }
            });
        });

    }
    {if $zsfield}
        $("#sc").show();
    {/if}
    function del(num){
        $("#zs_"+num).remove();
    }
    layui.config({
                base: '/static/xadmin/js/' //此处路径请自行处理, 可以使用绝对路径
            }).extend({
                formSelects: 'formSelects-v4'
            });
layui.use(['form', 'layer','laydate','upload'],
        function() {
          $ = layui.jquery;
          var form = layui.form, layer = layui.layer;
          var laydate = layui.laydate;
          var upload = layui.upload;
          
          form.on("select(teacher)",function(data){
            if(data.value==2){
                layer.msg('请填写具体职责');
                $("#other").show();
            }else{
                $("#other").hide();
            }
          });
          
          form.on('checkbox(switchTest)', function (data) {
            if(data.value=='无'&&data.elem.checked){
                $("#sc").hide();
                $("input[name='zhizheng[]']").prop("checked", false);      //全部取消选中
                $(this).prop("checked", true); 
            }else{
                $("#sc").show();
                $("#sc5").prop("checked", false);
            }
            form.render('checkbox');
        　　 //获取选中的value值
        });
            //演示多文件列表
  var uploadListIns = upload.render({
    elem: '#testList'
    ,elemList: $('#demoList') //列表元素对象
    ,url: '/index/index/uploadfield'
    ,accept: 'file'
    ,multiple: true
    ,number: 3
    ,auto: false
    ,bindAction: '#testListAction'
    ,choose: function(obj){   
      var that = this;
      var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
      //读取本地文件
      obj.preview(function(index, file, result){
            var tr = $(['<tr id="upload-'+ index +'">'
              ,'<td>'+ file.name +'</td>'
              ,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>'
              ,'<td><div class="layui-progress" lay-filter="progress-demo-'+ index +'"><input type="hidden" name="zsfield[]" id="zs_'+index+'" /><div class="layui-progress-bar" lay-percent=""></div></div></td>'
              ,'<td>'
                ,'<button class="layui-btn layui-btn-xs demo-reload layui-hide">重传</button>'
                ,'<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
              ,'</td>'
            ,'</tr>'].join(''));
            
            //单个重传
            tr.find('.demo-reload').on('click', function(){
              obj.upload(index, file);
            });
            
            //删除
            tr.find('.demo-delete').on('click', function(){
              delete files[index]; //删除对应的文件
              tr.remove();
              uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值，以免删除后出现同名文件不可选
            });
            
            that.elemList.append(tr);
            element.render('progress'); //渲染新加的进度条组件
          });
        }
        ,done: function(res, index, upload){ //成功的回调
          var that = this;
          console.log(index);
          console.log(res);
           //保存记录
          $("#zs_"+index).val(res.msg);
          
          //if(res.code == 0){ //上传成功
            var tr = that.elemList.find('tr#upload-'+ index)
            ,tds = tr.children();
            tds.eq(3).html(''); //清空操作
            delete this.files[index]; //删除文件队列已经上传成功的文件
            return;
          //}
          
         
          this.error(index, upload);
        }
        ,allDone: function(obj){ //多文件上传完毕后的状态回调
          console.log(obj)
        }
        ,error: function(index, upload){ //错误回调
          var that = this;
          var tr = that.elemList.find('tr#upload-'+ index)
          ,tds = tr.children();
          tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
        }
        ,progress: function(n, elem, e, index){ //注意：index 参数为 layui 2.6.6 新增
          element.progress('progress-demo-'+ index, n + '%'); //执行进度条。n 即为返回的进度百分比
        }
      });
  
          var uploadInst = upload.render({
            elem: '#test1'
            ,url: '/index/index/uploadimg' //改成您自己的上传接口
            ,before: function(obj){
              //预读本地文件示例，不支持ie8
              obj.preview(function(index, file, result){
                $('#demo1').attr('src', result); //图片链接（base64）
              });

              element.progress('demo', '0%'); //进度条复位
              layer.msg('上传中', {icon: 16, time: 0});
            }
            ,done: function(res){
              //如果上传失败
              if(res.code > 0){
                return layer.msg('上传失败');
              }
              //上传成功的一些操作
              $("#imgurl").val(res.msg);
              //……
              $('#demoText').html(''); //置空上传失败的状态
            }
            ,error: function(){
              //演示失败状态，并实现重传
              var demoText = $('#demoText');
              demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
              demoText.find('.demo-reload').on('click', function(){
                uploadInst.upload();
              });
            }
            //进度条
            ,progress: function(n, elem, e){
              element.progress('demo', n + '%'); //可配合 layui 进度条元素使用
              if(n == 100){
                layer.msg('上传完毕', {icon: 1});

                // $("#imgurl").val(e.msg);
              }
            }
          });
          form.on('select(city)',function(data){
            // console.log(data.value);
            $.ajax({
              url:'/index/register/getqu',
              data:{id:data.value},
              type:'post',
              dataType:'json',
              success:function(res){
                $("#qu").html("");
                $.each(res.msg, function(key, val) {
                  var option1 = $("<option>").val(val.id).text(val.title);
                  $("#qu").append(option1);
                  form.render('select');
                });
              }
            });
            // console.log(data);
            if(data.value==68||data.value==2){
                $("#school").show();
            }else{
                $("#school").hide();
            }
          });
          form.on('select(qu)',function(data){
            // console.log(data.value);
            $.ajax({
              url:'/index/register/getschool',
              data:{id:data.value},
              type:'post',
              dataType:'json',
              success:function(res){
                $("#aschool").html("");
                $.each(res.msg, function(key, val) {
                  var option1 = $("<option>").val(val.id).text(val.title);
                  $("#aschool").append(option1);
                  form.render('select');
                });
                // $("#cid").get(0).selectedIndex=0;
              }
            });
          });
          laydate.render({
            elem: '#date',
            trigger: 'click'
          });
          lay('.date').each(function () {
            laydate.render({
              elem: this, //元素
            });
          });
          //监听提交
          form.on('submit(add)', function(data) {
            var idcard = $("#idcard").val();
            if(idcard.length!=18){
              layer.msg('身份证号填写错误');
              return false;
            }
            var phone = $("#phone").val();
            if(phone.length!=11){
              layer.msg('联系方式填写错误');
              return false;
            }
            //验证邮箱
            var myReg=/^[a-zA-Z0-9_-]+@([a-zA-Z0-9]+\.)+(com|cn|net|org)$/;
            var myemail = $("#mail").val();
            if(!myReg.test(myemail)){
              // myspan.innerText="邮箱格式不对!";
              layer.msg('邮箱格式不对!');
              return false;
            }
            // console.log(data);
            //发异步，把数据提交给php
            $.ajax({
              url:"",
              data:data.field,
              type:'post',
              dataType:'json',
              success:function (res) {
                if (res.status==1){
                  layer.msg("保存成功",{icon:6,time:1500},function() {
                    location.href='/index/user/shenhe';
                  });
                }else{
                  layer.alert(res.msg,function (index) {
                    layer.close(index);
                  })
                }
              }
            })

            return false;
          });

        });
  var w = 0;
  function add() {
    var html = '';
    w += 1;
    html += '<div id="w_' + w + '">\n' +
            '        <div class="layui-form-item">\n' +
            '          <label for="username" class="layui-form-label">\n' +
            '            <span class="x-red">*</span>时间\n' +
            '          </label>\n' +
            '          <div class="layui-input-inline">\n' +
            '            <input name="w_stime['+w+']" placeholder="开始时间" autocomplete="off"  class="layui-input date"/> 至 <input name="w_etime['+w+']" placeholder="截止时间" autocomplete="off"  class="layui-input date"/>&nbsp;&nbsp; <button type="button" class="layui-btn  layui-btn-danger" onclick="lot(' + w + ')">删除</button>\n' +
            '          </div>\n' +
            '        </div>\n' +
            '        <div class="layui-form-item">\n' +
            '          <label for="username" class="layui-form-label">\n' +
            '            <span class="x-red">*</span>所在单位\n' +
            '          </label>\n' +
            '          <div class="layui-input-inline">\n' +
            '            <input name="w_danwei['+w+']" placeholder="所在单位" autocomplete="off" class="layui-input"/>\n' +
            '          </div>\n' +
            '        </div>\n' +
            '        <div class="layui-form-item">\n' +
            '          <label for="username" class="layui-form-label">\n' +
            '            <span class="x-red">*</span>经历\n' +
            '          </label>\n' +
            '          <div class="layui-input-inline">\n' +
            '            <textarea placeholder="请输入内容" name="w_jingli['+w+']" class="layui-textarea"></textarea>\n' +
            '          </div>\n' +
            '        </div>\n' +
            '      </div>';
    $(".gongzuojingli").append(html);
    layui.use('laydate', function(){
      var laydate = layui.laydate;
      //对每个laydate
      lay('.date').each(function(){
        laydate.render({
          elem: this,
          trigger: 'click'
        });
      });
    });
  }
  var p = 0;
  function add1(){
    var html = '';
    p+=1;
    html += '<div id="p_'+p+'">\n' +
            '        <div class="layui-form-item">\n' +
            '          <label for="username" class="layui-form-label">\n' +
            '            <span class="x-red">*</span>时间\n' +
            '          </label>\n' +
            '          <div class="layui-input-inline">\n' +
            '            <input name="p_stime['+p+']" placeholder="开始时间" autocomplete="off"  class="layui-input date"/> 至 <input name="p_etime['+p+']" placeholder="截止时间" autocomplete="off"  class="layui-input date"/>&nbsp;&nbsp;  <button type="button" class="layui-btn  layui-btn-danger" onclick="lot1('+p+')">删除</button>\n' +
            '          </div>\n' +
            '        </div>\n' +
            '        <div class="layui-form-item">\n' +
            '          <label for="username" class="layui-form-label">\n' +
            '            <span class="x-red">*</span>所在单位\n' +
            '          </label>\n' +
            '          <div class="layui-input-inline">\n' +
            '            <input name="p_danwei['+p+']" placeholder="所在单位" autocomplete="off" class="layui-input"/>\n' +
            '          </div>\n' +
            '        </div>\n' +
            '        <div class="layui-form-item">\n' +
            '          <label for="username" class="layui-form-label">\n' +
            '            <span class="x-red">*</span>经历\n' +
            '          </label>\n' +
            '          <div class="layui-input-inline">\n' +
            '            <textarea placeholder="请输入内容" name="p_jingli['+p+']" class="layui-textarea"></textarea>\n' +
            '          </div>\n' +
            '        </div>\n' +
            '      </div>';
    $(".peixunjingli").append(html);
    layui.use('laydate', function(){
      var laydate = layui.laydate;
      //对每个laydate
      lay('.date').each(function(){
        laydate.render({
          elem: this,
          trigger: 'click'
        });
      });
    });
  }
  function lot(num){
    // alert(num);
    t--;
    $("#w_"+num).remove();
  }
function lot1(num){
  // alert(w);
  w--;
  $("#p_"+num).remove();
}
var t=0;
function add2(){
  var html ='';
  t+=1;
  html +=' <div id="t_'+t+'"><div class="layui-input-inline" style="margin-top: 20px;">\n' +
          '          <input name="t_stime['+t+']" placeholder="开始时间" autocomplete="off"  class="layui-input date"/> 至 <input name="t_etime['+t+']" placeholder="截止时间" autocomplete="off"  class="layui-input date"/>&nbsp;&nbsp;  <button type="button" class="layui-btn layui-btn-sm" onclick="add2()">增加</button> <button type="button" class="layui-btn layui-btn-danger" onclick="lot2('+t+')">删除</button>\n' +
          '        </div>';
  $("#teach").append(html);
  layui.use('laydate', function(){
    var laydate = layui.laydate;
    //对每个laydate
    lay('.date').each(function(){
      laydate.render({
        elem: this,
        trigger: 'click'
      });
    });
  });
}
function lot2(num){
  $("#t_"+num).remove();
}
</script>

</body>

{/block}
